#include<iostream>
#include<vector>
using namespace std;


int GetNum(vector<int>& a, int b)
{
	int len = a.size();
	int l = 0, r = len - 1;
	while (l < r)
	{
		int mid = l + (r - l) / 2;
		if (a[mid] < b)
		{
			l = mid + 1;
		}
		else
		{
			r = mid;
		}
	}
	if (a[l] == b)
	{
		return l + 1;
	}
	return -1;
}
int main()
{
	int n = 0, m = 0;
	cin >> n >> m;
	vector<int> a(n);
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	vector<int> b(m);
	for (int j = 0; j < m; j++)
	{
		cin >> b[j];
	}
	vector<int> ret(m);
	for (int i = 0; i < m; i++)
	{
		ret[i] = GetNum(a, b[i]);
	}
	for (int i = 0; i < m; i++)
	{
		cout << ret[i] << " ";
	}
	cout << endl;
	return 0;
}
